package com.example.a001.part18;


import android.content.Context;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

public class ExternalClickListener implements View.OnClickListener {

    private Context context;
    private EditText etUsername, etPassword;

    public ExternalClickListener(Context context, EditText etUsername, EditText etPassword) {
        this.context = context;
        this.etUsername = etUsername;
        this.etPassword = etPassword;
    }

    @Override
    public void onClick(View v) {
        String username = etUsername.getText().toString();
        String password = etPassword.getText().toString();
        Toast.makeText(context, "用户名: " + username + ", 密码: " + password, Toast.LENGTH_SHORT).show();
    }
}